import Taro from '@tarojs/taro'
import React, { useState } from 'react'
import './index.scss'
import { View, Text } from '@tarojs/components'
import CImage from '../../components/CImage/index'

interface ITF {
  img?: ''
  title?: ''
  price?: ''
  subTitle?: ''
  personNum?: ''
  type: number
}
export default function CHomeMoreCard(params: ITF) {
  const { img, title, price, subTitle, personNum, type } = params
  const storagesystem = Taro.getStorageSync('system')
  const [system] = useState(storagesystem)

  return (
    <View className='curriculumItem'>
      <View className='curriculumItemLeft'>
        <CImage src={img}></CImage>
        {system.indexOf('iOS') < 0 ? (
          price && price > 0 ? (
            <View className='priceNum'>￥{price}</View>
          ) : (
            <View className='priceNum'>免费</View>
          )
        ) : price && price > 0 ? (
          <View className='priceNum'>免费</View>
        ) : (
          <View className='priceNum'>免费</View>
        )}
      </View>
      <View className='curriculumItemRight'>
        <Text className='itemTitle'>{title}</Text>
        <View style='fontSize:14px;marginTop:10px'>
          <Text>{subTitle}</Text>
        </View>
        <View style='fontSize:14px;color:#999;text-align:right'>{type === 1 ? <Text>{personNum ? personNum : 0}人已测</Text> : ''}</View>
      </View>
    </View>
  )
}
